package com.jushu.storbox.database;

import java.util.List;

import com.jushu.storbox.entities.UploadObject;

public interface IUploadFileDao  extends IBaseDao{

	public final static String TABLE_NAME_UPLOAD_FILE_LIST = "tb_upload_file_list";
	public static final String current_user_id = "current_user_id";
	public final static String TABLE_COMMAND = "Create table " + TABLE_NAME_UPLOAD_FILE_LIST + "("
			+ FIELD_ID 			+ " integer,"
			+ id 				+ " text,"
			+ owner_by 			+ " text,"
			+ file_sha1 		+ " text,"
			+ extend_identity	+ " text,"
			+ file_name 		+ " text,"
			+ parent_folder_id 	+ " text,"
			+ trans_status 		+ " integer,"
			+ current_progress 	+ " integer,"
			+ file_size 		+ " integer,"
			+ current_size 		+ " integer,"
			+ current_index 	+ " integer,"
			+ local_path 		+ " text,"
			+ upload_path 		+ " text,"
			+ lastUpdateDate 	+ " integer,"
			+ type 				+ " integer,"
			+ notify_id			+ " integer,"
			+ current_user_id	+ " text,"
			+ "CONSTRAINT pk_tb_upload_list PRIMARY KEY"
			+ "(" + owner_by+","+parent_folder_id + "," +local_path + ")"
			+ ")";
	
	public final static String UPDATE_COMMAND = TABLE_COMMAND;
	
	/**
	 * @param fileInfo
	 * @param context
	 */
	public long insertFile(UploadObject fileInfo);
	

	public int updateUploadObject(UploadObject fileInfo);
	
	/**
	 * insert notify
	 * @param notifyId
	 * @return
	 */
	public long insertNotify(int notifyId);
	
	/**
	 * delete notify
	 * @param notifyId
	 * @return
	 */
	public void deleteNotify(int notifyId);
	
	/**
	 * delete all exception notify
	 */
	public void deleteAllNotify();
	
	/**
	 * @param fileId
	 * @param ownerId
	 */
	public void deleteFile(String fileId, String ownerId);
	
	public void deleteFile(UploadObject fileInfo);
	
	/**
	 * 
	 * @param id
	 * @param transStatus 0 no download，1 wait download    2. downloading    3.download finished    4.pause   5.stop

	 */
	public void updateUploadState(String fileId, String ownerId, int transStatus);
	
	/**
	 * 
	 * @param fileId
	 * @param uploadUrl
	 */
	public void updateUploadUrl(String fileId, String ownerId, String uploadUrl);
	
	/**
	 * @param fileId
	 * @param currentProgress
	 */
	public void updateProgress(String fileId, String ownerId, long currentProgress);
	
	/**
	 * 
	 * @param fileId
	 * @param indexFinished
	 */
	public void updateCurrentIndex(String fileId, String ownerId, String indexFinished);
	
	public List<UploadObject> getUploadFileList();
	
	public List<UploadObject> getComplateUploadFileList();
	
	public List<UploadObject> getNotComplateUploadFileList();
	
	public List<UploadObject> getAlbumBackupFailuredLi();
	
	/**
	 * Get notify id list
	 * @return
	 */
	public List<Integer> getNotifyList();
	
	public UploadObject getUploadFileFileInfoById(String fileId, String ownerId);
	
	public UploadObject getUploadFileFileInfoBySha1(String fileId, String ownerId, String folderId);
	
	public UploadObject getUploadFile(String ownerId, String folderId, String filePath);
}
